package com.ykt.model;

import com.jfinal.plugin.activerecord.Page;
import com.ykt.interceptor.Seach;

public class OrderDetail extends SeachModel<OrderDetail>{

	private static final long serialVersionUID = 1L;
	public static final OrderDetail dao = new OrderDetail();
	public Product getProduct(){
		return Product.dao.findById(get("product_id"));
	}
	@Override
	public Page<OrderDetail> paginate(int pageNumber, int rows, Seach seach) {
		String select="select a.*,p.*";
		String sqlExceptSelect = " from order_detail a left JOIN product p on a.product_id = p.id   where 1=1 ";
		return paginateBySelect(select, sqlExceptSelect, pageNumber, rows, seach);
	}
	
}
